package studentmanage.mapper;

import org.apache.ibatis.annotations.Delete;
import studentmanage.entity.Students;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface StudentMapper {
    /**
     * 查询所有学生
     * @return
     */
    @Select("select * from students")
    List<Students> selectAllStudent();

//    @Insert("insert into students (name,gender,class_name,personal_phone,qq,parent_phone,home_address,dorm_address) " +
//            "values" +
//            "(${name},${gender},${className},${personalPhone},${qq},${parentPhone},${homeAddress},${dormAddress}) ")
    void addStudent(Students students);

    @Delete("delete from students where student_id=#{studentId}")
    void deleteStudent(long studentId);

    void updateStudent(Students students);

    @Select("select * from students where student_id=#{studentId}")
    Students selectByStudentId(long studentId);
}
